<%--
  Created by IntelliJ IDEA.
  User: 86187
  Date: 2021/10/21
  Time: 10:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="resource/bootstrap4/css/bootstrap.css">
    <script src="resource/js/jquery-3.2.1.js"></script>
    <script src="resource/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="resource/bootstrap4/js/bootstrap.js"></script>
    <script src="resource/My97DatePicker/WdatePicker.js"></script>
    <title>列表</title>
<script>
    function goPage(PageNum){
        $("#nav-tabContent").load("list?pageNum="+PageNum+"&"+$("form").serialize());
    }

    function px1(pageNum){
        $("[name='order2']").val("");
        $("[name='order3']").val("");
        var msg = "";
        var order1 = $("[name='order1']").val();
        if(order1==""){
            msg = "asc";
        }
        if(msg=="asc"){
            msg = "desc";
        }
        if(msg=="desc"){
            msg = "asc";
        }
        $("[name='order1']").val(msg);
        goPage(pageNum);
    }

    function px2(pageNum){
        $("[name='order1']").val("");
        $("[name='order3']").val("");
        var msg = "";
        var order2 = $("[name='order2']").val();
        if(order2==""){
            msg = "asc";
        }
        if(msg=="asc"){
            msg = "desc";
        }
        if(msg=="desc"){
            msg = "asc";
        }
        $("[name='order2']").val(msg);
        goPage(pageNum);
    }

    function px3(pageNum){
        $("[name='order1']").val("");
        $("[name='order2']").val("");
        var msg = "";
        var order3 = $("[name='order3']").val();
        if(order3==""){
            msg = "asc";
        }
        if(msg=="asc"){
            msg = "desc";
        }
        if(msg=="desc"){
            msg = "asc";
        }
        $("[name='order3']").val(msg);
        goPage(pageNum);
    }

    function toAdd(){
        $("#nav-tabContent").load("toAdd");
    }
</script>
</head>
<body>
<span>欢迎${uname}</span>
<form:form modelAttribute="vo" method="post" action="list">
    发布时间:<input type="date" name="created" value="<fmt:formatDate value='${vo.created}' pattern='yyyy-MM-dd'></fmt:formatDate>">至
    <input type="date" name="created1" value="<fmt:formatDate value='${vo.created1}' pattern='yyyy-MM-dd'></fmt:formatDate>">
    <form:select path="rtype">
        <form:option value="">--请选择--</form:option>
        <form:option value="ztpackage">制图文件</form:option>
        <form:option value="zzr">制作人</form:option>
        <form:option value="shr">审核人</form:option>
    </form:select>
    <form:input path="mohu"></form:input>
    <form:select path="qtype">
        <form:option value="">--请选择--</form:option>
        <form:option value="zvernum">主版本号</form:option>
        <form:option value="cvernum">从版本号</form:option>
    </form:select>
    <form:input path="z"></form:input>
    <form:input path="c"></form:input>
    排序 <<a href="javascript:px1(1)">发布时间</a>
    <input type="text" name="order1" value="${vo.order1}">
        <<a href="javascript:px2(1)">主版本号</a>
    <input type="text" name="order2" value="${vo.order2}">
        <<a href="javascript:px3(1)">从版本号</a>
    <input type="text" name="order3" value="${vo.order3}">
    <input type="button" value="查询" onclick="goPage(1)">
    <input type="button" value="添加" onclick="toAdd()">
</form:form>
<form>
    <table class="table table-striped">
        <thead>
        <tr>
            <th scope="col">发布时间</th>
            <th scope="col">品牌</th>
            <th scope="col">品类</th>
            <th scope="col">产品编号</th>
            <th scope="col">主版本号</th>
            <th scope="col">从版本号</th>
            <th scope="col">制图文件</th>
            <th scope="col">总用量</th>
            <th scope="col">制作人</th>
            <th scope="col">审核人</th>
            <th scope="col">备注</th>
        </tr>
        </thead>
        <c:forEach items="${info.list}" var="a">
        <tbody>
        <tr>
            <td>
                <fmt:formatDate value="${a.created}" pattern="yyyy-MM-dd"></fmt:formatDate>
            </td>
            <td>${a.types}</td>
            <td>${a.ptype}</td>
            <td>${a.cpid}</td>
            <td>${a.zvernum}</td>
            <td>${a.cvernum}</td>
            <td>
                <c:forTokens items="${a.ztpackage}" delims="," var="pic">
                    <img src="${pic}" width="80px" height="80px">
                </c:forTokens>
            </td>
            <td>${a.zlose}</td>
            <td>${a.user.uname}</td>
            <td>${a.shr}</td>
            <td>${a.mark}</td>
        </tr>
        </tbody>
        </c:forEach>
    </table>
    <jsp:include page="/resource/common/pages2.jsp"></jsp:include>
</form>

</body>
</html>